#pragma once
#include <d3dx9.h>
#include <d3d9.h>
#include "ResourceManager.h"
#include "Vertex.h"
#include "D3DApp.h"
#include "MathDef.h"

#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_TEX1)

class CSprite
{
public:
	CSprite(void);
	CSprite(int texId);
	virtual ~CSprite(void);
	void SetTexture(int id);
	void SetTexture(int id, float left, float top, float right, float bottom);
	void SetBorder(CRect* r);
	void Render();
	void Render(CRect* border, CRect* texCoord);
	void BuildVertexBuffer();

private:
	IDirect3DTexture9* m_Tex;
	IDirect3DVertexBuffer9* mVB;
	IDirect3DIndexBuffer9* mIB;
	CRect m_TexRect;
	CRect m_Border;
};
